import { ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsInt, IsISO8601, IsOptional, IsPositive, IsString, Max, MaxLength, Min } from "class-validator";

export class ListOutputsDto {
  @ApiPropertyOptional({ description: "按项目筛选", example: "proj_123" })
  @IsOptional()
  @IsString()
  @MaxLength(100)
  projectId?: string;

  @ApiPropertyOptional({ description: "开始日期 (包含)", example: "2025-09-01" })
  @IsOptional()
  @IsISO8601()
  from?: string;

  @ApiPropertyOptional({ description: "结束日期 (包含)", example: "2025-09-30" })
  @IsOptional()
  @IsISO8601()
  to?: string;

  @ApiPropertyOptional({ description: "页码，从 1 开始", default: 1 })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  page = 1;

  @ApiPropertyOptional({ description: "每页数量", default: 20, maximum: 100 })
  @Type(() => Number)
  @IsInt()
  @IsPositive()
  @Max(100)
  pageSize = 20;
}
